package Command;

import Command.Calculator.Operator;

public class Client {

	
	public static void main(String args[]){
		
		Light light = new Light();//receiver
		
		//concrete commands, should know receiver 
		ICommand  turnOnCommand = new LightOnCommand(light);
		ICommand  turnOffCommand = new LightOffCommand(light);
		
		//Command Manger(Invoker)
		CommandManager cm = new CommandManager();
		
		cm.setCommand(turnOnCommand); 
		cm.doIt();
		cm.setCommand(turnOffCommand);
		cm.doIt();
		
		//another receiver
		final Calculator calculator = new Calculator();
		
		//use anonymous instance of ICommand
		cm.setCommand(
				new ICommand(){
					@Override
					public void excute() {
						calculator.Operation(Operator.ADD, 3);
					}
				}
		);
		cm.doIt();
		
		cm.setCommand(
				new ICommand(){
					@Override
					public void excute() {
						calculator.Operation(Operator.MUL, 2);
					}
				}
		);
		cm.doIt();
		
		
	}
	
	
}
